/**
 * 
 */
package mdb.com.vn.persist;

import java.io.Serializable;

import org.springframework.stereotype.Repository;

import mdb.com.vn.model.Company;

/**
 * @author tu.dod
 * 
 */
@Repository("companyDAO")
public class CompanyDAOImpl extends AbstractHibernateDAOImpl<Company, Integer>
		implements CompanyDAO, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected Class<Company> getDomainClass() {
		// TODO Auto-generated method stub
		return Company.class;
	}

	@Override
	public String findCompanyNameByCode(String code) {
		try {
			Company company = (Company) getSession()
					.getNamedQuery("Company.findByCode").setString("id", code)
					.uniqueResult();
			return company.getComapnyName();
		} catch (Exception e) {
			return "N/A";
		}

	}

}
